<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Aria: ArMD5Calculator Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Aria
   &#160;<span id="projectnumber">2.9.4</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classArMD5Calculator.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="classArMD5Calculator-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">ArMD5Calculator Class Reference<div class="ingroups"><a class="el" href="group__UtilityClasses.html">Utility Classes</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Calculates the MD5 checksum when reading or writing a text file using ArFunctors.  
 <a href="classArMD5Calculator.html#details">More...</a></p>

<p><code>#include &lt;ArMD5Calculator.h&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:aeca285eb7c968becf9d4a61f68fd740d"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom">{ <a class="el" href="classArMD5Calculator.html#aeca285eb7c968becf9d4a61f68fd740da1c49adf9388dec84457b4f47ec6a0cbb">DIGEST_LENGTH</a> = 16, 
<a class="el" href="classArMD5Calculator.html#aeca285eb7c968becf9d4a61f68fd740dac98025b3fc272549daee5ddae9891b10">DISPLAY_LENGTH</a> = (DIGEST_LENGTH * 2) + 1
 }</td></tr>
<tr class="separator:aeca285eb7c968becf9d4a61f68fd740d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a2a324c364297833ecac7753b560b40bd"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2a324c364297833ecac7753b560b40bd"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMD5Calculator.html#a2a324c364297833ecac7753b560b40bd">append</a> (const char *str)</td></tr>
<tr class="memdesc:a2a324c364297833ecac7753b560b40bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the checksum for the given text line, and accumulates the results. <br /></td></tr>
<tr class="separator:a2a324c364297833ecac7753b560b40bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad90a558420ceff563300e34105ec079d"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMD5Calculator.html#ad90a558420ceff563300e34105ec079d">ArMD5Calculator</a> (<a class="el" href="classArFunctor1.html">ArFunctor1</a>&lt; const char * &gt; *secondFunctor=NULL)</td></tr>
<tr class="memdesc:ad90a558420ceff563300e34105ec079d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new calculator, with an optional functor.  <a href="#ad90a558420ceff563300e34105ec079d">More...</a><br /></td></tr>
<tr class="separator:ad90a558420ceff563300e34105ec079d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aef4103c21641a51a33e73eca8c777bca"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aef4103c21641a51a33e73eca8c777bca"></a>
unsigned char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMD5Calculator.html#aef4103c21641a51a33e73eca8c777bca">getDigest</a> ()</td></tr>
<tr class="memdesc:aef4103c21641a51a33e73eca8c777bca"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a pointer to the internal buffer that accumulates the checksum results. <br /></td></tr>
<tr class="separator:aef4103c21641a51a33e73eca8c777bca"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab2305b6b6eb70bd19038d4a9e573d709"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classArFunctor1.html">ArFunctor1</a>&lt; const char * &gt; *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMD5Calculator.html#ab2305b6b6eb70bd19038d4a9e573d709">getFunctor</a> ()</td></tr>
<tr class="memdesc:ab2305b6b6eb70bd19038d4a9e573d709"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the internal functor used to calculate the checksum.  <a href="#ab2305b6b6eb70bd19038d4a9e573d709">More...</a><br /></td></tr>
<tr class="separator:ab2305b6b6eb70bd19038d4a9e573d709"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeaed713440b44b3390261ca1f3ff05f0"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aeaed713440b44b3390261ca1f3ff05f0"></a>
<a class="el" href="classArFunctor1.html">ArFunctor1</a>&lt; const char * &gt; *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMD5Calculator.html#aeaed713440b44b3390261ca1f3ff05f0">getSecondFunctor</a> ()</td></tr>
<tr class="memdesc:aeaed713440b44b3390261ca1f3ff05f0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the optional secondary functor to be called on each text line. <br /></td></tr>
<tr class="separator:aeaed713440b44b3390261ca1f3ff05f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a64f94e252440188ae8a5645b7253b6c7"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a64f94e252440188ae8a5645b7253b6c7"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMD5Calculator.html#a64f94e252440188ae8a5645b7253b6c7">reset</a> ()</td></tr>
<tr class="memdesc:a64f94e252440188ae8a5645b7253b6c7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Resets the calculator so that a new checksum can be calculated. <br /></td></tr>
<tr class="separator:a64f94e252440188ae8a5645b7253b6c7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a74700595af320f4e13bb445d8173ac1f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a74700595af320f4e13bb445d8173ac1f"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMD5Calculator.html#a74700595af320f4e13bb445d8173ac1f">setSecondFunctor</a> (<a class="el" href="classArFunctor1.html">ArFunctor1</a>&lt; const char * &gt; *secondFunctor)</td></tr>
<tr class="memdesc:a74700595af320f4e13bb445d8173ac1f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the optional secondary functor to be called on each text line. <br /></td></tr>
<tr class="separator:a74700595af320f4e13bb445d8173ac1f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a458484fc2b7bb2059e6c85de4d5de8c5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a458484fc2b7bb2059e6c85de4d5de8c5"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMD5Calculator.html#a458484fc2b7bb2059e6c85de4d5de8c5">~ArMD5Calculator</a> ()</td></tr>
<tr class="memdesc:a458484fc2b7bb2059e6c85de4d5de8c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <br /></td></tr>
<tr class="separator:a458484fc2b7bb2059e6c85de4d5de8c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a116c11f846d8fdf055aa202d388dec8f"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMD5Calculator.html#a116c11f846d8fdf055aa202d388dec8f">calculateChecksum</a> (const char *fileName, unsigned char *md5DigestBuffer, size_t md5DigestBufferLen)</td></tr>
<tr class="memdesc:a116c11f846d8fdf055aa202d388dec8f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the checksum for the specified file.  <a href="#a116c11f846d8fdf055aa202d388dec8f">More...</a><br /></td></tr>
<tr class="separator:a116c11f846d8fdf055aa202d388dec8f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abf82e1535ba09d30f0696792c6f9e43b"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMD5Calculator.html#abf82e1535ba09d30f0696792c6f9e43b">toDisplay</a> (const unsigned char *digestBuf, size_t digestLength, char *displayBuf, size_t displayLength)</td></tr>
<tr class="memdesc:abf82e1535ba09d30f0696792c6f9e43b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Converts the given checksum buffer to a displayable text string.  <a href="#abf82e1535ba09d30f0696792c6f9e43b">More...</a><br /></td></tr>
<tr class="separator:abf82e1535ba09d30f0696792c6f9e43b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Calculates the MD5 checksum when reading or writing a text file using ArFunctors. </p>
<p><a class="el" href="classArMD5Calculator.html" title="Calculates the MD5 checksum when reading or writing a text file using ArFunctors. ...">ArMD5Calculator</a> is a small helper class used to calculate MD5 checksums on text files. It contains a static method that will calculate the checksum of a given file, independently performing all I/O.</p>
<p>The calculator also contains a functor that can be used to calculate a checksum interactively. For example, it can accumulate the checksum while a file is being written using a writeToFunctor method. If the optional second functor is specified, then it will be invoked after the checksum functor. </p>
</div><h2 class="groupheader">Member Enumeration Documentation</h2>
<a class="anchor" id="aeca285eb7c968becf9d4a61f68fd740d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">anonymous enum</td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="aeca285eb7c968becf9d4a61f68fd740da1c49adf9388dec84457b4f47ec6a0cbb"></a>DIGEST_LENGTH&#160;</td><td class="fielddoc">
<p>Number of bytes in the checksum buffer. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="aeca285eb7c968becf9d4a61f68fd740dac98025b3fc272549daee5ddae9891b10"></a>DISPLAY_LENGTH&#160;</td><td class="fielddoc">
<p>Number of characters needed to display the checksum. </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ad90a558420ceff563300e34105ec079d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ArMD5Calculator::ArMD5Calculator </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classArFunctor1.html">ArFunctor1</a>&lt; const char * &gt; *&#160;</td>
          <td class="paramname"><em>secondFunctor</em> = <code>NULL</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates a new calculator, with an optional functor. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">secondFunctor</td><td>the optional functor to be invoked on the current text string after its checksum has been calculated </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a116c11f846d8fdf055aa202d388dec8f"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool ArMD5Calculator::calculateChecksum </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>fileName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>md5DigestBuffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>md5DigestBufferLen</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Calculates the checksum for the specified file. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">fileName</td><td>the name of the file of which to calculate the checksum </td></tr>
    <tr><td class="paramname">md5DigestBuffer</td><td>a pointer to the output buffer in which to store the calculated checksum </td></tr>
    <tr><td class="paramname">md5DigestBufferLen</td><td>the length of the md5DigestBuffer; should be DIGEST_LENGTH </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>bool true if the file was successfully opened and the checksum calculated; false, otherwise </dd></dl>

</div>
</div>
<a class="anchor" id="ab2305b6b6eb70bd19038d4a9e573d709"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classArFunctor1.html">ArFunctor1</a>&lt; const char * &gt; * ArMD5Calculator::getFunctor </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the internal functor used to calculate the checksum. </p>
<p>If the calculator is being used interactively with writeToFunctor, then this is the functor to use. It calls append on each text line which accumulates the checksum and calls the second functor if necessary. </p>

</div>
</div>
<a class="anchor" id="abf82e1535ba09d30f0696792c6f9e43b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void ArMD5Calculator::toDisplay </td>
          <td>(</td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>digestBuf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>digestLength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>displayBuf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>displayLength</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Converts the given checksum buffer to a displayable text string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">digestBuf</td><td>a pointer to the byte array that contains the checksum </td></tr>
    <tr><td class="paramname">digestLength</td><td>the length of the disgestBuf; should be DIGEST_LENGTH </td></tr>
    <tr><td class="paramname">displayBuf</td><td>a pointer to the output text buffer that will contain the displayable text string </td></tr>
    <tr><td class="paramname">displayLength</td><td>the length of the displayBuf; should be at least DISPLAY_LENGTH </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="ArMD5Calculator_8h.html">ArMD5Calculator.h</a></li>
<li>ArMD5Calculator.cpp</li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="classArMD5Calculator.html">ArMD5Calculator</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
